﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MvcMovie.Controllers
{
    public class HelloWorldController : Controller
    {
        /// <summary>
        /// below field demonstrate that a new instance will be created to process each request
        /// and static variable can be used to record some state across requests
        /// </summary>
        private static int m_numInstance = 0;

        public HelloWorldController()
        {
            ++m_numInstance;
        }

        //
        // GET: /HelloWorld/
        public ActionResult Index()
        {
            // View returns ViewResult, which derives from ActionResult
            return View();
        }

        public ActionResult Welcome(string name, int numTimes = 1)
        {
            ViewBag.Message = "hello " + name;
            ViewBag.NumTimes = numTimes;

            return View();
        }

    }
}
